package com.gqz.patrol.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;


/**
 * @ClassName EnPatrolTaskElectricityEntity
 * @Description 电量采集信息表
 */


@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("T_EN_PATROL_TASK_ELECTRICITY")
public class EnPatrolTaskElectricityEntity implements Serializable {

    /**
     * 主键
     */
    @TableId
    private String id;

    /**
     * 单位id
     */
    @TableField(value = "UNIT_ID")
    private String unitId;

    /**
     * 单位名称
     */
    @TableField(value = "UNIT_NAME")
    private String unitName;

    /**
     * 所属单据编号
     */
    @TableField(value = "TASK_NO")
    private String taskNo;

    /**
     * 所属工单名称
     */
    @TableField(value = "TASK_NAME")
    private String taskName;

    /**
     * 能源站点id
     */
    @TableField(value = "ENERGY_SITE_ID")
    private String energySiteId;

    /**
     * 能源站点名称
     */
    @TableField(value = "ENERGY_SITE_NAME")
    private String energySiteName;

    /**
     * 配电柜名称
     */
    @TableField(value = "POWER_DIST_NAME")
    private String powerDistName;

    /**
     * 配电柜编码
     */
    @TableField(value = "POWER_DIST_NO")
    private String powerDistNo;

    /**
     * 电表编号
     */
    @TableField(value = "ELECTRICITY_METER_NO")
    private String electricityMeterNo;

    /**
     * 电表名称
     */
    @TableField(value = "ELECTRICITY_METER_NAME")
    private String electricityMeterName;

    /**
     * 电量
     */
    @TableField(value = "ELECTRICITY_NUM")
    private String electricityNum;

    /**
     * 采集时间
     */
    @TableField(value = "ACQ_TIME")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(name = "acqTime", format = "yyyy-MM-dd HH:mm:ss")
    private Date acqTime;

    /**
     * 采集人
     */
    @TableField(value = "ACQ_PERSON")
    private String acqPerson;

    /**
     * 电表照片
     */
    @TableField(value = "ELECTRICITY_PIC")
    private String electricityPic;

    /**
     * 创建人
     */
    @TableField(value = "CREATOR")
    private String creator;

    /**
     * 创建时间
     */
    @TableField(value = "CREATE_TIME")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(name = "createTime", format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 是否删除
     */
    @TableField(value = "DELETED")
    private String deleted;

    /**
     * 采集时间至
     */
    @TableField(value = "ACQ_TIME_TO")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(name = "acqTimeTo", format = "yyyy-MM-dd HH:mm:ss")
    private Date acqTimeTo;

    private static Map<String, SFunction<EnPatrolTaskElectricityEntity, ?>> map;

    static {
        map = new HashMap<>();
        map.put("id", EnPatrolTaskElectricityEntity::getId);
        map.put("unitId", EnPatrolTaskElectricityEntity::getUnitId);
        map.put("unitName", EnPatrolTaskElectricityEntity::getUnitName);
        map.put("taskNo", EnPatrolTaskElectricityEntity::getTaskNo);
        map.put("taskName", EnPatrolTaskElectricityEntity::getTaskName);
        map.put("energySiteId", EnPatrolTaskElectricityEntity::getEnergySiteId);
        map.put("energySiteName", EnPatrolTaskElectricityEntity::getEnergySiteName);
        map.put("powerDistName", EnPatrolTaskElectricityEntity::getPowerDistName);
        map.put("electricityMeterNo", EnPatrolTaskElectricityEntity::getElectricityMeterNo);
        map.put("electricityMeterName", EnPatrolTaskElectricityEntity::getElectricityMeterName);
        map.put("electricityNum", EnPatrolTaskElectricityEntity::getElectricityNum);
        map.put("acqTime", EnPatrolTaskElectricityEntity::getAcqTime);
        map.put("acqPerson", EnPatrolTaskElectricityEntity::getAcqPerson);
        map.put("electricityPic", EnPatrolTaskElectricityEntity::getElectricityPic);
        map.put("creator", EnPatrolTaskElectricityEntity::getCreator);
        map.put("createTime", EnPatrolTaskElectricityEntity::getCreateTime);
        map.put("deleted", EnPatrolTaskElectricityEntity::getDeleted);
        map.put("acqTimeTo", EnPatrolTaskElectricityEntity::getAcqTimeTo);
        map.put("powerDistNo", EnPatrolTaskElectricityEntity::getPowerDistNo);
    }

    public static SFunction<EnPatrolTaskElectricityEntity, ?> genColumnSFunction(String column) {
        return map.get(column);
    }


}
